function wordLoad(){for(key in dataStory){var t=dataStory[key];if("word"==t.objectType){var e=new Konva.Group({id:key,x:t.x,y:t.y,qcObject:!0,data:t});grpStory.add(e);var r=new Konva.Text({id:"answerText",x:t.textX,y:t.textY,fill:t.textColor,fontSize:t.textfontSize,fontStyle:"bold",fontFamily:"Trebuchet MS, sans-serif",lineHeight:1.5,letterSpacing:10,textDecoration:"underline",data:t});e.add(r);var n=new Konva.Group({id:"grpLetters",x:0,y:0});e.add(n);var a=(answer=t.target).split("");function d(t){for(let e=t.length-1;e>0;e--){let r=Math.floor(Math.random()*(e+1));[t[e],t[r]]=[t[r],t[e]]}}d(a),nextX=0;for(let i=0;i<a.length;i++){var o=a[i],c=new Konva.Group({x:nextX,letter:o});n.add(c),initButton(c,0),c.on("pointerdown ",function(){checkLock=!1;var t=this.getAttr("letter");this.hide(),this.opacity(0),answerWord=r.text()+t,r.text(answerWord),answerWord.length,a.length});var g=new Image,h=new Konva.Image({image:g});c.add(h),g.src=stagePath+t.boxSrc,fontSize=t.boxWidth/2;var f=new Konva.Text({y:(t.boxHeight-(fontSize+7))/2,width:t.boxWidth,fontSize:fontSize,fill:t.boxTextColor,text:o,align:"center",fontStyle:"bold",fontFamily:"Trebuchet MS, sans-serif",lineHeight:1.5});c.add(f),nextX+=t.boxWidth+t.boxSpace}}}}function wordChecker(t,e){var r=new Image;r.onload=function(){var e=new Konva.Image({id:"checker",x:t.getAttr("data").checkerX,y:t.getAttr("data").checkerY,width:t.getAttr("data").checkerWidth,height:t.getAttr("data").checkerHeight,image:r});t.add(e)},e?r.src=stagePath+t.getAttr("data").checkerCorrectSrc:r.src=stagePath+t.getAttr("data").checkerWrongSrc}function wordCheck(){var t=grpStory.getChildren();for(key in t){var e=t[key];if(e.getAttr("data")&&"word"==e.getAttr("data").objectType){storyTotalObject++,(answerText=e.findOne("#answerText")).text()==e.getAttr("data").target?(storyTotalCorrect++,e.setAttr("success",!0),wordChecker(e,!0)):wordChecker(e,!1);var r=(grpLetters=e.findOne("#grpLetters")).getChildren();for(key in r)r[key].hide()}}}function wordSolve(){var t=grpStory.getChildren();for(key in t){var e=t[key];if(e.getAttr("data")&&"word"==e.getAttr("data").objectType){grpLetters=e.findOne("#grpLetters"),(answerText=e.findOne("#answerText")).text(e.getAttr("data").target),(checker=e.findOne("#checker"))&&checker.destroy();var r=grpLetters.getChildren();for(key in r)r[key].hide()}}}function wordReset(){var t=grpStory.getChildren();for(key in t){var e=t[key];if(e.getAttr("data")&&"word"==e.getAttr("data").objectType){grpLetters=e.findOne("#grpLetters"),(answerText=e.findOne("#answerText")).text(""),(checker=e.findOne("#checker"))&&checker.destroy();var r=grpLetters.getChildren();for(key in r)r[key].show(),new Konva.Tween({node:r[key],duration:Math.random(r.length),opacity:1,easing:Konva.Easings.StrongEaseInOut}).play()}}}